]> dgit.raspbian.org Git - gnome-shell.git/commit
st/widget: Don't animate theme node updates on theme context changes
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 24 Jul 2025 16:51:25 +0000 (18:51 +0200)
committerMarge Bot <marge-bot@gnome.org>
Sat, 30 Aug 2025 21:40:30 +0000 (21:40 +0000)
commit9ed77ef13e809da12567a5d6725ac2525581f28b
tree9f184f829e67a1d6dd8231552a404c727aaf1394
parent18c4023533bc2eb44e71766bd568254292db1060
st/widget: Don't animate theme node updates on theme context changes

With commit 4dfa39457e, I was assuming that emitting `::changed` on the
StThemeContext, triggering StWidgets recursive style-changed machinery,
is enough to get rid of all the theme nodes that are in use, ensuring
they're never accessed again after the `::changed` emission.

That assumption turned out to be wrong: `st_widget_recompute_style()`
animates updates of theme nodes using StThemeNodeTransition, and
StThemeNodeTransition keeps the old theme node around, accessing it at
various later points. This caused various crashes on extension
loading/unloading, because that triggers a theme context change, where
a StThemeNodeTransition would later access an outdated theme node,
pointing to CSS properties that are already freed.

That said, reverting 4dfa39457e doesn't seem like the best idea,
because other calls to `st_theme_context_changed()` also seem to make
the same (incorrect) assumption, eg. `st_theme_context_set_theme()`
seems like a good candidate for a similar crash.

Probably St just shouldn't try to animate on theme context changes: The
old theme nodes are no longer usable after those, but
StThemeNodeTransition expects them to be, so that's just a bad idea.

So change the style-changed machinery a bit to allow disabling transitions
and use that to avoid transitions on theme context changes.

Fixes: 4dfa39457e ("st/theme-context: Also remove theme nodes on stylesheet changes")
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7339
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3809>
src/st/st-widget.c